﻿using System;
using System.Drawing;
using System.Windows.Forms;

namespace SimpleTerminal.Controls
{
    public partial class PageContainer : Control
    {
        public TabLayout TabLayout;
        public EventHandler IndicatorChanged;
        protected bool indicator;

        public bool Indicator
        {
            get
            {
                return indicator;
            }
            set
            {
                indicator = value;
                IndicatorChanged?.Invoke(this, EventArgs.Empty);
            }
        }

        public PageContainer()
        {
            SetStyle(ControlStyles.ResizeRedraw, true);
            SetStyle(ControlStyles.Selectable, false);
            InitializeComponent();
        }


        public PageContainer(Control control) : base()
        {
            Controls.Add(control);
        }

        protected override void OnPaint(PaintEventArgs pe)
        {
            //base.OnPaint(pe);
            pe.Graphics.FillRectangle(new SolidBrush(BackColor), pe.ClipRectangle);
        }
        protected override void WndProc(ref Message m)
        {
            base.WndProc(ref m);
        }

        protected override void OnPaintBackground(PaintEventArgs pevent)
        {
            base.OnPaintBackground(pevent);
        }

        protected override void OnEnter(EventArgs e)
        {
            base.OnEnter(e);
        }

        protected override void OnMouseClick(MouseEventArgs e)
        {
            base.OnMouseClick(e);
        }

        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);
            // Console.WriteLine("OnMouseDown");
        }
        protected override void OnGotFocus(EventArgs e)
        {
            base.OnGotFocus(e);
            if (Controls.Count > 0)
                Controls[0].Select();
        }
        //protected override on

    }
}
